﻿#region Using Statements
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Content;
using System;
#endregion

namespace pigs
{
    /// <summary>
    /// The options screen is brought up over the top of the main menu
    /// screen, and gives the user a chance to configure the game
    /// in various hopefully useful ways.
    /// </summary>
    class BeastsScreen : MenuScreen
    {
        ContentManager content;
        Texture2D beastsImage;
        Boolean fade;

        /// <summary>
        /// Constructor.
        /// </summary>
        public BeastsScreen(ScreenManager screen, Boolean fadeOther)
            : base("Types of Pigs")
        {
            this.fade = fadeOther;

            MenuEntry back = new MenuEntry("Back");
            back.Position = new Vector2(screen.GraphicsDevice.Viewport.Width / 2, 800);
            back.Selected += OnCancel;
            MenuEntries.Add(back);
        }

        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Content");

            this.beastsImage = content.Load<Texture2D>("menu/beasts");
        }

        /// <summary>
        /// Draws the loading screen.
        /// </summary>
        public override void Draw(GameTime gameTime)
        {
            Viewport viewport = ScreenManager.GraphicsDevice.Viewport;
            Vector2 viewportSize = new Vector2(viewport.Width, viewport.Height);

            base.Draw(gameTime);
            SpriteBatch spriteBatch = ScreenManager.SpriteBatch;

            if (fade)
            {
                // Darken down any other screens that were drawn beneath the popup.
                ScreenManager.FadeBackBufferToBlack(TransitionAlpha / 3);
            }

            Color color = Color.White * TransitionAlpha * TransitionAlpha;

            // Draw the text.
            spriteBatch.Begin();
            spriteBatch.Draw(beastsImage, new Vector2((viewportSize.X - this.beastsImage.Width) / 2, 150), color);
            spriteBatch.End();
        }
    }
}
